import java.util.Scanner;
public class test418 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a year: ");
        int year = scanner.nextInt();
        System.out.print("Enter a month: ");
        String month = scanner.next();
        String[] validMonths = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
        boolean isValidMonth = false;
        for (String m : validMonths) {
            if (m.equals(month)) {
                isValidMonth = true;
                break;
            }
        }
        if (!isValidMonth) {
            System.out.println(month + " is not a correct month name");
        } else {
            int days;
            switch (month) {
                case "Apr": case "Jun": case "Sep": case "Nov":
                    days = 30;
                    break;
                case "Feb":
                    if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                        days = 29;
                    } else {
                        days = 28;
                    }
                    break;
                default: 
                    days = 31;
            }
            System.out.println(month + " " + year + " has " + days + " days");
        }
        scanner.close();
    }
}

